package com.thomas.framework.web.interceptor;

import com.thomas.framework.utils.ReflectUtil;
import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.aop.ProxyMethodInvocation;

import java.lang.reflect.Method;

/**
 * 日志处理类
 * Created by taohj on 2014/5/24.
 */



public class LogHandlerAdapter {

    Logger logger = Logger.getLogger(this.getClass());


    public Object invoke(ProceedingJoinPoint obj) throws Throwable {

        ProxyMethodInvocation methodInvocation = (ProxyMethodInvocation) ReflectUtil.getFieldValue(obj, "methodInvocation");
        Method method = methodInvocation.getMethod();

       logger.info("Class:" + method.getDeclaringClass().getName() + "----MethodName:" + method.getName());


        return obj.proceed();
    }

}
